/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.be;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Freddy
 */
@Entity
@Table(name = "GAR_ITEM_PIGNORATICIO")
@NamedQueries({
    @NamedQuery(name = "ItemPignoraticio.findAll", query = "SELECT i FROM ItemPignoraticio i"),
    @NamedQuery(name = "ItemPignoraticio.findByIdItemPignoraticio", query = "SELECT i FROM ItemPignoraticio i WHERE i.idItemPignoraticio = :idItemPignoraticio"),
    @NamedQuery(name = "ItemPignoraticio.findByTipoJoya", query = "SELECT i FROM ItemPignoraticio i WHERE i.tipoJoya = :tipoJoya"),
    @NamedQuery(name = "ItemPignoraticio.findByValor", query = "SELECT i FROM ItemPignoraticio i WHERE i.valor = :valor"),
    @NamedQuery(name = "ItemPignoraticio.findByMetal", query = "SELECT i FROM ItemPignoraticio i WHERE i.metal = :metal"),
    @NamedQuery(name = "ItemPignoraticio.findByKilataje", query = "SELECT i FROM ItemPignoraticio i WHERE i.kilataje = :kilataje")
})
public class ItemPignoraticio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_ITEM_PIGNORATICIO")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idItemPignoraticio;
    @Column(name = "TIPO_JOYA")
    private String tipoJoya;
    @Column(name = "VALOR")
    private BigDecimal valor;
    @Column(name = "METAL")
    private String metal;
    @Column(name = "KILATAJE")
    private String kilataje;
    @JoinColumn(name = "FID_GAR_PIGNORATICIA", referencedColumnName = "ID_PIGNORATICIA")
    @ManyToOne(fetch = FetchType.LAZY)
    private GarantiaPignoraticia fidGarPignoraticia;

    public ItemPignoraticio() {
    }

    public ItemPignoraticio(Long idItemPignoraticio) {
        this.idItemPignoraticio = idItemPignoraticio;
    }

    public Long getIdItemPignoraticio() {
        return idItemPignoraticio;
    }

    public void setIdItemPignoraticio(Long idItemPignoraticio) {
        this.idItemPignoraticio = idItemPignoraticio;
    }

    public String getTipoJoya() {
        return tipoJoya;
    }

    public void setTipoJoya(String tipoJoya) {
        this.tipoJoya = tipoJoya;
    }

    public BigDecimal getValor() {
        return valor;
    }

    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    public String getMetal() {
        return metal;
    }

    public void setMetal(String metal) {
        this.metal = metal;
    }

    public String getKilataje() {
        return kilataje;
    }

    public void setKilataje(String kilataje) {
        this.kilataje = kilataje;
    }

    public GarantiaPignoraticia getFidGarPignoraticia() {
        return fidGarPignoraticia;
    }

    public void setFidGarPignoraticia(GarantiaPignoraticia fidGarPignoraticia) {
        this.fidGarPignoraticia = fidGarPignoraticia;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idItemPignoraticio != null ? idItemPignoraticio.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemPignoraticio)) {
            return false;
        }
        ItemPignoraticio other = (ItemPignoraticio) object;
        if ((this.idItemPignoraticio == null && other.idItemPignoraticio != null) || (this.idItemPignoraticio != null && !this.idItemPignoraticio.equals(other.idItemPignoraticio))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.gar.be.ItemPignoraticio[idItemPignoraticio=" + idItemPignoraticio + "]";
    }

}
